package com.naiterui.ehp.bs.agent.websocket;

import cn.hutool.json.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * websocket消息实体
 *
 * @author gaoliangliang
 * @since 2022/2/22
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class WebsocketMessage {
    /**
     * 目标用户，若为all则为全量
     *
     * @see WebsocketConstant.ALL_USER
     */
    private String toUserId;
    /**
     * 消息
     */
    private String message;
    /**
     * 来源用户
     */
    private String fromUserId;

    public String toJson() {
        return JSONUtil.toJsonStr(this);
    }
}
